//
//  TTBeautyManagerCell.m
//  TaTaBang
//
//  Created by 李禹 on 15/8/29.
//  Copyright (c) 2015年 hailong. All rights reserved.
//

#import "TTBeautyManagerCell.h"
#import "Pet.h"

@interface TTBeautyManagerCell ()

@property (weak, nonatomic) IBOutlet UIImageView *photoImageView;
@property (weak, nonatomic) IBOutlet UIImageView *sexImageView;
@property (weak, nonatomic) IBOutlet UIImageView *nameImageView;
@property (weak, nonatomic) IBOutlet UILabel *nameLabel;
@property (weak, nonatomic) IBOutlet UILabel *masterTipLabel;
@property (weak, nonatomic) IBOutlet UILabel *masterLabel;
@property (weak, nonatomic) IBOutlet UILabel *no1TipLabel;
@property (weak, nonatomic) IBOutlet UILabel *no1Label;
@property (weak, nonatomic) IBOutlet UILabel *no2TipLabel;
@property (weak, nonatomic) IBOutlet UILabel *no2Label;
@property (weak, nonatomic) IBOutlet UILabel *no3TipLabel;
@property (weak, nonatomic) IBOutlet UILabel *no3Label;
@property (weak, nonatomic) IBOutlet UILabel *timeLabel;
@property (weak, nonatomic) IBOutlet UIButton *moreButton;
@property (weak, nonatomic) IBOutlet UIButton *editButton;

@end

@implementation TTBeautyManagerCell

+ (instancetype)beautyManagerCellWithTableView:(UITableView *)tableView {
    static NSString *identifier = @"TTBeautyManagerCell";
    TTBeautyManagerCell *cell = [tableView dequeueReusableCellWithIdentifier:identifier];
    if (!cell) {
        cell = [[[NSBundle mainBundle] loadNibNamed:@"TTBeautyManagerCell" owner:nil options:nil] lastObject];
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
    }
    return cell;
}
- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
}

- (void)setPet:(Pet *)pet {
    _pet = pet;
    
    self.editButton.selected = pet.selected;
}

- (void)setType:(HeaderViewType)type {
    _type = type;
    if (type == HeaderViewTypeFeedService){
        [self loadDataNo1TipText:@"寄养时间：" no1Text:@"2015/08/01-2015/08/02" no2TipText:@"消费金额：" no2Text:@"￥150" no3TipText:@"服务员" no3Text:@"赵晓花"];
        self.timeLabel.hidden = YES;
    }else if(type == HeaderViewTypeBeautyManager){
        [self loadDataNo1TipText:@"消费金额：" no1Text:@"￥150" no2TipText:@"类别" no2Text:@"美容" no3TipText:@"服务员" no3Text:@"赵晓花"];
        self.timeLabel.hidden = NO;
    }else if (type == HeaderViewTypeTrainManager) {
        [self loadDataNo1TipText:@"编号：" no1Text:@"0100000" no2TipText:@"消费金额：" no2Text:@"￥150" no3TipText:@"训练天数" no3Text:@"7天"];
        self.timeLabel.hidden = YES;
    }
}

- (void)loadDataNo1TipText:(NSString *)no1Tip no1Text:(NSString *)no1Text no2TipText:(NSString *)no2Tip no2Text:(NSString *)no2Text  no3TipText:(NSString *)no3Tip no3Text:(NSString *)no3Text {
    self.no1TipLabel.text = no1Tip;
    self.no1Label.text = no1Text;
    
    self.no2TipLabel.text = no2Tip;
    self.no2Label.text = no2Text;
    
    self.no3TipLabel.text = no3Tip;
    self.no3Label.text = no3Text;
    
    self.timeLabel.hidden = NO;
}

- (IBAction)editButtonDidClick:(UIButton *)sender {
    sender.selected = !sender.selected;
    
    self.pet.selected = sender.selected;
    
    if ([self.delegate respondsToSelector:@selector(beautyManagerCell:didSelectedEditButton:)]) {
        [self.delegate beautyManagerCell:self didSelectedEditButton:self.pet];
    };

    
}

- (void)setEditStatus:(BOOL)editStatus {
    _editStatus = editStatus;
    
    self.editButton.hidden = !editStatus;
}

- (IBAction)moreButtonDidClick:(UIButton *)sender {
}


@end
